<template>
  <div class="yjfk" style="padding: 20px">
    <div class="yj">意见反馈<i class="el-icon-close" style="color: white" @click="goBack()"></i></div>
    <div class="the">
      <textarea v-model="feedback" placeholder="请写下您的意见反馈"></textarea>
      <button class="fabu" @click="submitFeedback">发布</button>
      <button class="qvxiao" @click="cancelFeedback">取消</button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      feedback: ''
    }
  },
  methods: {
    //发布反馈
    async submitFeedback() {
      var obj = {
        feedback_content: this.feedback,
        user_id: this.$store.state.publisherid//死数据,到时候这里是登录的用户id
      }
      const { data: res } = await this.$http.post('/feed/insert', obj)
      if (res) {
        //清空文本框内容
        this.feedback ='';
        this.$message.success("反馈成功！")
      }else{
        this.$message.error("反馈失败！")
      }

    },
    cancelFeedback(){
      this.feedback='';
    },
      goBack() {
          this.$router.go(-1);
      },
  }
}

</script>

<style>
.yjfk {
  width: 1600px;
  height: 400px;
}
.yj {
  width: 1000px;
  height: 50px;
  background-color: rgb(0, 136, 255);
  text-align: center;
  font-size: 40px;
  margin: 0 auto;
}
.yjfk .the {
  width: 800px;
  height: 350px;
  margin: 30px auto;
}
.yjfk .the textarea {
  width: 800px;
  height: 300px;
}
.yjfk .the .fabu {
  float: right;
  width: 80px;
  height: 40px;
}
.yjfk .the .qvxiao {
  float: left;
  height: 40px;
  width: 80px;
}
</style>
